const fs = require("fs");
const path = require("path");
//读取info.json 并转化为数组
const res = fs.readFileSync(path.join(__dirname, "../info.json"), "utf-8");

// console.log(res);

const arr = JSON.parse(res);
// console.log(arr);
const i = Math.floor(Math.random() * arr.length);
//累加count 的值
arr[i].count++;
console.log(arr);
console.log(i);
console.log(arr[i].count);
// 重新保存回info.json
fs.writeFileSync(path.join(__dirname, "../info.json"),JSON.stringify(arr), "utf8");
